<?php
session_start();

if(!isset($_SESSION['id'])){
	header('Location:login.php');
}
 $id=intval($_POST['id']);

 /*$connection=mysql_connect("localhost","root","");
 mysql_select_db("shenji",$connection);
 mysql_query("set names utf8");
 $sql="select * from user where id=$id";
 $result=mysql_query($sql);
 $row=mysql_fetch_array($result);
 echo json_encode($row);*/
	$db=new PDO('mysql:host=localhost;dbname=shenji','root','');
	$db->query("set names utf8");
	$rs=$db->query("select * from user where id=".$id,PDO::FETCH_ASSOC);
	while($row=$rs->fetch()){
		echo json_encode($row);
	}
	$db=null;
?>